/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gm.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Med EL MOUDDENE
 */
@Entity
@Table(name = "handicape")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Handicape.findAll", query = "SELECT h FROM Handicape h"),
    @NamedQuery(name = "Handicape.findByIdHandicap", query = "SELECT h FROM Handicape h WHERE h.idHandicap = :idHandicap")})
public class Handicape implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_HANDICAP")
    private Integer idHandicap;
    @Lob
    @Size(max = 65535)
    @Column(name = "TYPE")
    private String type;
    @ManyToMany(mappedBy = "handicapeCollection")
    private Collection<Personne> personneCollection;

    public Handicape() {
    }

    public Handicape(Integer idHandicap) {
        this.idHandicap = idHandicap;
    }

    public Integer getIdHandicap() {
        return idHandicap;
    }

    public void setIdHandicap(Integer idHandicap) {
        this.idHandicap = idHandicap;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @XmlTransient
    public Collection<Personne> getPersonneCollection() {
        return personneCollection;
    }

    public void setPersonneCollection(Collection<Personne> personneCollection) {
        this.personneCollection = personneCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHandicap != null ? idHandicap.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Handicape)) {
            return false;
        }
        Handicape other = (Handicape) object;
        if ((this.idHandicap == null && other.idHandicap != null) || (this.idHandicap != null && !this.idHandicap.equals(other.idHandicap))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gm.entities.Handicape[ idHandicap=" + idHandicap + " ]";
    }
    
}
